<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"> 
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Determinações</h2>
            <br/>
            <h:form id="form" acceptcharset="utf-8">
                <p:growl id="msg" life="5000"/>
                <h:panelGrid  style="width: 100%;">
                        
                    <p:dataTable value="#{managerCloseDetermination.findAll()}" var="d"
                                     emptyMessage="Nenhuma determinação" style="width: 100%;"
                                     styleClass="dataTable">
                            <f:facet name="header">
                                <h:outputText value="Determinações"/>
                            </f:facet>
                          
                            <p:column headerText="Cartório" style="font-size: 12px;">
                                <h:outputText value="#{d.notaryOffice.nome}" style="font-size: 12px;"/>
                            </p:column>
                            
                            <p:column headerText="Juiz" style="font-size: 12px;">
                                <h:outputText value="#{d.executor.name}" style="font-size: 12px;"/>
                            </p:column>
                            
                            <p:column headerText="Data" style="font-size: 12px; ">
                                <h:outputText value="#{d.date}" style="font-size: 12px;">
                                     <f:convertDateTime pattern="dd/MM/yyyy" />
                                    
                                </h:outputText>
                            </p:column>
                        
                            <p:column style="font-size: 12px; ">
                                <p:dataTable value="#{d.determinations}" var="da" >
                                    <p:column headerText="Determinações" style="font-size: 12px; ">
                                     <h:outputText value="#{da.descricao}" style="font-size: 12px;" />
                            </p:column>
                             <p:column headerText="Opções" style="font-size: 12px; width: 50px;">
                                 <p:commandButton icon="ui-icon-gear" title="Fechar" oncomplete="dlg.show()">
                                     <f:setPropertyActionListener target="#{managerCloseDetermination.determinations}" value="#{da}" />
                                 </p:commandButton>
                            </p:column>
                                    
                                </p:dataTable>
                            </p:column>
                        
                           
                        </p:dataTable>
                    </h:panelGrid>
                
                 <p:dialog header="Fechar Determinação" widgetVar="dlg" modal="true" width="400">  
                     <h:outputText value="Observações :" style="margin-bottom: 6px;float: left"/>
                 <p:inputTextarea value="#{managerCloseDetermination.textToClose}"  rows="3" cols="43" />  
                 <center>
                     <p:commandButton  icon="ui-icon-circle-check" value="Confirmar" action="#{managerCloseDetermination.closeDetermination()}" oncomplete="dlg.hide()" update="@form"/>
                 </center>
</p:dialog>  
            </h:form>
        </ui:define>
    </ui:composition>
</html>